//
//  wireless_os.h
//  wireless_sensor
//
//  Created by fukai on 2018/11.
//  Copyright © 2018年 赛博智能车实验室. All rights reserved.
//

#ifndef wireless_os_h
#define wireless_os_h

/********主机部分********/

//数据接收状态
typedef enum
{
	RECEIVE_OK,
	RECEIVE_FAILD,
}DataReceiveStatusNode;

//传感器报警状态
typedef enum
{
	MASTER_NORMAL,
	MASTER_YELLOW_ALERT,
	MASTER_RED_ALERT,
}MasterAlertLevelNode;

//主机接收温湿度传感信息
typedef struct
{
	unsigned char temperature;	//温度
	unsigned char humidity;		//湿度
	unsigned char *data_buffer;	//数据缓冲区
	
	DataReceiveStatusNode DataReceiveStatus;
	MasterAlertLevelNode MasterAlertLevel;
}WiSenMasterNode;

void MasterDataBufferUpdate(void);//传感器数据缓冲区更新
void MasterUserInterface(void);//主机用户界面显示
void MasterDataAnalysis(void);//主机接收信息分析
void MasterAlertProcess(void);//主机报警处理
extern WiSenMasterNode WiSenMaster;
/********从机部分********/

//数据传输状态
typedef enum
{
	SEND_OK,
	SEND_FAILD,
}DataSendStatusNode;

//传感器报警状态
typedef enum
{
	NORMAL,
	YELLOW_ALERT,
	RED_ALERT,
}AlertLevelNode;

//温湿度传感部分信息
typedef struct
{
	unsigned char temperature;	//温度
	unsigned char humidity;		//湿度
	unsigned char *data_buffer;	//数据缓冲区
	
	DataSendStatusNode DataSendStatus;
	AlertLevelNode AlertLevel;
}WiSenSlaveNode;

void user_interface(void);//用户界面显示
void SensorAlertProcess(void);
void DataAnalysis(void);//传感器信息分析
void DataBufferUpdate(void);//传感器数据缓冲区更新
extern WiSenSlaveNode WiSenSlave;


#endif


